import * as cc from "cc";
import { GlobalEnum } from "./GlobalEnum";

//玩家数据示例
export default class PlayerDataTemplate {
    private constructor() { }
    public static getData(): any {
        return {
            //第一次登陆时间
            fristLoginTimer: 0,
            /**是否已完成游戏教学 */
            teached: false,
            //游戏存档数据
            gameData: {
                curLevel: 1,
                //玩家资源
                asset: {
                    gold: 0,        //金币
                    power: 10,      //体力
                },
                //抽奖次数
                spinCount: 0,
                lastFreeTime: 0,
                //解锁皮肤
                unlockSkin: 0,
                //主角皮肤
                PlayerSkin: {
                    cur: 0,         //当前使用的皮肤
                    try: -1,        //当前试用的皮肤，-1表示无试用皮肤
                    owned: [1],     //已拥有的皮肤
                    videoCount: {
                        1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0,
                        11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, 19: 0, 20: 0,
                        21: 0, 22: 0, 23: 0, 24: 0, 25: 0, 26: 0, 27: 0, 28: 0, 29: 0, 30: 0,
                        31: 0,
                    },
                },
                //装饰品
                HatSkin: {
                    cur: 0,         //当前选择的装饰品，0表示没有
                    try: -1,
                    owned: [],
                    videoCount: {
                        1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0,
                        11: 0, 12: 0, 13: 0, 14: 0, 15: 0,
                    }
                },
                //武器
                WeaponSkin: {
                    cur: {
                        type: GlobalEnum.WeaponType.katana,
                        id: 1,
                    },
                    try: {
                        type: GlobalEnum.WeaponType.none,
                        id: 0,
                    },
                    //每种类型的武器解锁的皮肤id
                    owned: {
                        "captain": [1],
                        "claw": [1],
                        "gun": [1],
                        "hunter": [1],
                        "katana": [1],
                        "knife": [1],
                        "trapper": [1],
                    },
                    videoCount: {
                        "captain": {
                            1: 0, 2: 0, 3: 0,
                        },
                        "claw": {
                            1: 0, 2: 0, 3: 0,
                        },
                        "gun": {
                            1: 0,
                        },
                        "hunter": {
                            1: 0, 2: 0,
                        },
                        "katana": {
                            1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0,
                        },
                        "knife": {
                            1: 0, 2: 0, 3: 0, 4: 0,
                        },
                        "trapper": {
                            1: 0,
                        },
                    }
                },
            },
        };
    }
}
/**用户信息 */
export class UserInfo {
    public static fristLoginTimer = 0;
    public static needuserinfo = 0;
    protected static _openid = "";
    public static get openid() {
        if (!this._openid) {
            this._openid = cc.sys.localStorage.getItem("openid");
        }
        return this._openid;
    }
    public static set openid(v) {
        this._openid = v;
        cc.sys.localStorage.getItem("openid");
    }

    public static sessid = "aaaa";
    public static userid = "";
}